<?php
/**
 * Created by PhpStorm.
 * User: HuangLuSen
 * Date: 2017/5/18
 * Time: 16:30
 */

namespace app\zjs\controller;


use app\admin\model\Employee;
use app\common\model\Order;
use think\Db;

class Ph extends Zjs
{
    public function index()
    {

        $data = new Order();
        $map['daoru'] = 3;
        $map['qd_depar'] = 6;
        $map['ywstate'] = ['in',[6]];
        $re=$data->where($map)->group('tjr_id')->order('tjnum desc')->field('COUNT(tjr_id) as tjnum,tjr_id,bumen')->select();
        foreach ($re as $v){
            if(!empty($v['tjr_id'])){
                $a=$v->toArray();
                $a['zjsuser'] = $v->zjsry_text;
                $a['bumen'] = $v->zjsbumen_text;
                $a['url'] = Db::name('customer')->where(['id'=>$a['tjr_id']])->value('avatar');
                $arr[]= $a;
            }
        }
        $this->assign('arr',$arr);
        return $this->fetch('index/list');
    }
}